package com.mingqijia.gassafety.console.controller.inner;


import com.gap.basic.base.CommonResponse;
import com.mingqijia.gassafety.shared.response.HuiShengDetailOrderResp;
import com.mingqijia.gassafety.webserver.request.inner.ServiceComboRecordRequest;
import com.mingqijia.gassafety.webserver.request.inner.ServiceComboSyncRequest;
import com.mingqijia.gassafety.webserver.request.inner.SyncOrderDataRespose;
import com.mingqijia.gassafety.webserver.response.inner.ServiceComboRecordRespose;
import com.mingqijia.gassafety.webserver.service.workorder.SyncServiceComboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Api(tags = "服务套餐接口")
@RestController(value = "ServiceComboController")
@RequestMapping("/inner/v1/service/combo")
public class SyncServiceComboController {

    @Autowired
    private SyncServiceComboService syncServiceComboService;

    @ApiOperation("同步服务套餐接口")
    @RequestMapping(value = "/syncCombo", method = RequestMethod.POST)
    public CommonResponse<Boolean> syncCombo(@RequestBody List<ServiceComboSyncRequest> request) {
        log.info("同步服务套餐接口:{}",request.toString());
        return syncServiceComboService.syncCombo(request);
    }

    @ApiOperation("服务套餐记录详情")
    @RequestMapping(value = "/serviceLogs", method = RequestMethod.POST)
    public CommonResponse<List<ServiceComboRecordRespose>> serviceLogs(@RequestBody ServiceComboRecordRequest request) {
        log.info("服务套餐记录详情:{}",request.toString());
        return CommonResponse.success(syncServiceComboService.serviceLogs(request));
    }

    @ApiOperation("师傅帮个忙工单信息同步")
    @RequestMapping(value = "/syncOrderData", method = RequestMethod.POST)
    public CommonResponse<Boolean> syncOrderData(@RequestBody SyncOrderDataRespose request) {
        log.info("师傅帮个忙工单信息同步:{}",request.toString());
        HuiShengDetailOrderResp orderResp = new HuiShengDetailOrderResp();
        return syncServiceComboService.syncOrderData(request);
    }
}
